<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>啤酒管理</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 内容区域 -->
    <el-card>
      <!-- 添加分类 -->
      <el-row>
        <el-col>
          <el-button type="success">添加分类</el-button>
        </el-col>
      </el-row>
      <!-- 表格区域 -->
      <el-table :data="catagory" border style="width: 100%" stripe row-key="id"
        :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
        <!-- <el-table-column label="#" type="index"></el-table-column> -->
        <el-table-column prop="manufacturer" label="制造厂">
        </el-table-column>
        <el-table-column prop="expireDate" label="有效期(天)">
        </el-table-column>
        <el-table-column prop="size" label="规格(L/升)"> </el-table-column>
        <el-table-column prop="alcohol" label="酒精度(°)"> </el-table-column>
        <el-table-column prop="malt" label="麦芽度(°)"> </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
              >编辑</el-button
            >
            <el-button
              size="mini"
              type="danger"
              @click="handleDelete(scope.$index, scope.row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'BeerList',
  data () {
    return {
      // 发起请求时的数据格式
      queryInfo: {
        type: 2, // 菜单的类型，1 为只获取一级菜单， 2 为 获取 一级，二级菜单
        pagenum: 1, // 请求数据的当前页码值
        pagesize: 5 // 每页显示多少条数据
      },
      catagory: [
        {
          id: 1,
          manufacturer: '燕京',
          expireDate: '',
          children: [
            {
              id: '11',
              manufacturer: '黄啤',
              expireDate: 60,
              size: 20
            },
            {
              id: '12',
              manufacturer: '黄啤',
              expireDate: 60,
              size: 20
            },
            {
              id: '13',
              manufacturer: '黑啤',
              expireDate: 60,
              size: 20

            }
          ]
        },
        {
          id: 2,
          manufacturer: '德国HB',
          children: [
            {
              id: '21',
              manufacturer: '黄啤',
              expireDate: 60,
              size: 20
            },
            {
              id: '22',
              manufacturer: '黑啤',
              expireDate: 60,
              size: 20
            }
          ]
        },
        {
          id: 3,
          manufacturer: '小于廉',
          children: [
            {
              id: '31',
              manufacturer: '白啤',
              expireDate: 60,
              size: 20
            },
            {
              id: '32',
              manufacturer: '原浆',
              expireDate: 60,
              size: 30
            }
          ]
        }
      ],
      total: 0
    }
  },
  created () {
    this.getBeerCatagory()
  },
  methods: {
    getBeerCatagory () {
      // 此处需要从服务获取分类列表数据
    }
  }
}
</script>

<style lang="less" scoped></style>
